home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / trueSpace 7.6 / tS761B8Std.exe / {app} / Scripts / ScriptCommands / DefaultLibScanner.xml < prev    next >
Extensible Markup Language  |  2008-06-10  |  6KB  |  155 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <SCRIPT Name="DefaultLibScanner" Type="Command" Language="ScriptObject Package/jScript language" UIName="" Description="default context libs scanner" GUID="{A368C449-5972-4fdd-BE95-BB3BE0700FF2}">
  3.     <SCRIPT_PARAM Name="Node Name" Type="string" Direction="In" Description="No description"/>
  4.     <SCRIPT_PARAM Name="Dynamic Lib Name" Type="string" Direction="In" Description="No description"/>
  5.     <SCRIPT_PARAM Name="LE Frame Name" Type="string" Direction="In" Description="No description"/>
  6.     <SCRIPT_PARAM Name="Dynamic Lib WinID" Type="string" Direction="Out" Description="No description"/>
  7.     <SCRIPT_PARAM Name="Lib Name" Type="string" Direction="Out" Description="No description"/>
  8.     <SCRIPT_CODE><![CDATA[
  9. function Execute(ret)
  10. {
  11.     /////////////////////////////////////////////////////////////////
  12.     // Default Scanner - creator of dynamic lib toolbar for LE
  13.     /////////////////////////////////////////////////////////////////
  14.  
  15.     // obtain input params 
  16.  
  17.     // scanned root
  18.     nodeName = ret.Param('Node Name'); 
  19.     // parent library name
  20.     LibParent = ret.Param('Dynamic Lib Name'); 
  21.     // LE frame for library toolbar
  22.     LEFrameName = ret.Param('LE Frame Name');
  23.     // created library ( previous name)
  24.     oldLibName = ret.Param('Lib Name');
  25.  
  26.     // new library
  27.     dynLibName = ''; 
  28.  
  29.     // skip root node
  30.     if (nodeName == '') 
  31.         return; 
  32.  
  33.     if (nodeName.indexOf('/LW Material Editor') != -1) 
  34.     {
  35.         // special case - LWME node, display more libs here 
  36.         try 
  37.         {
  38.             outlookFrameName = Library.ToggleSubLibraryEx('(/Libraries/Main Library)', '/Libraries/Main Library/LW Shaders', 1); 
  39.             WindowsManager.SnapFrameToFrameEx(LEFrameName, outlookFrameName, 10, 12, 0, 0);
  40.             WindowsManager.SetFrameOwnerFrame(outlookFrameName, LEFrameName); 
  41.         }
  42.         catch (e) {}; 
  43.  
  44.         dynLibName = Node.Create('Library Package/Library', LibParent);
  45.         Node.Copy('/Libraries/Context Library/LW Shader Bricks', dynLibName);
  46.     }                
  47.     else
  48.     {        
  49.         // scan for specific connectors to identify known objects
  50.         bShowD3D = false;
  51.         bShowLW = false;
  52.  
  53.         // D3D material - ME2 flavor - check for connectors 
  54.         if ((Node.ConExists(nodeName, '{8AC1B301-8385-462E-8D5F-1950BE149D23}') &&         //ME2Material
  55.             !Node.ConExists(nodeName, '{65769C74-E744-4543-9660-22F5E449574A}')) ||    // Mesh                 
  56.              Node.ConExists(nodeName, '{5604B7D0-101A-4ac0-8C69-16856C1010BE}') ||    //texcoord shader    
  57.              Node.ConExists(nodeName, '{0118D796-532C-4080-B5D3-76C654C956CA}') ||    //normal shader    
  58.              Node.ConExists(nodeName, '{D4A4CE71-AA49-4700-848A-FCFA47B949D5}') ||    //model shader    
  59.              Node.ConExists(nodeName, '{E0328037-A867-4eeb-849D-588B8E5ED454}') ||        //vertexlight shader    
  60.              Node.ConExists(nodeName, '{A202CC0A-0F8B-4bb7-A2A5-789BCF71141E}') ||        //light shader    
  61.              Node.ConExists(nodeName, '{35CB95EA-444F-472e-AAE5-1157661B3514}') ||        //color shader    
  62.              Node.ConExists(nodeName, '{531CB799-5EAF-4d13-937E-62AD0B14AA04}') ||        //alpha shader    
  63.              Node.ConExists(nodeName, '{13EA6B04-00B9-4604-B783-96B65FB98EBD}') ||        //vertex shader    
  64.              Node.ConDataTypeExists(nodeName, '{31DB0B46-352B-4e3f-B1EB-93E33E2FB512}') ||     //general brick connector    
  65.              Node.ConDataTypeExists(nodeName, '{72D6357E-129E-4d13-B0DC-24634DADB16B}') ||    //light properties     
  66.              Node.ConDataTypeExists(nodeName, '{E8A6C459-5B7E-4b44-AB0B-FC595E2994D8}')         //compatible light    
  67.          ) 
  68.          {
  69.              bShowD3D = true; 
  70.              System.Trace('scanner : D3d (ME2 flavor) material detected'); 
  71.          }        
  72.  
  73.  
  74.         // LW material - check for connectors
  75.         if (Node.ConExists(nodeName, '{0FEAB26E-C88B-4d6f-A16F-403B7A88BF1A}') ||    //alpha shader    
  76.              Node.ConExists(nodeName, '{6B757841-E35E-4a2d-81E8-FD8117414D8D}') ||    //color shader    
  77.              Node.ConExists(nodeName, '{B5389EEE-B106-40f6-A579-D864D0F81ECC}') ||    //model shader    
  78.              Node.ConExists(nodeName, '{A06CE001-6F55-4c58-99B3-1675DA6F49D6}') ||    //normal shader    
  79.              Node.ConDataTypeExists(nodeName, '{F3A64795-9A18-46ef-9CCC-F3F43A518982}')         //general LW brick connector    
  80.         ) 
  81.         {
  82.             bShowLW = true; 
  83.             System.Trace('scanner : LW material detected'); 
  84.         }        
  85.  
  86.         // action part - update dynamic library content 
  87.         if(bShowD3D || bShowLW)
  88.         {
  89.             //check if old library exists
  90.             if(oldLibName == '')
  91.             {
  92.                 // create library node
  93.                 dynLibName = Node.Create('Library Package/Library', LibParent);
  94.  
  95.                 if (bShowD3D) 
  96.                 {
  97.                     //Node.Copy('/Libraries/Context Library/Shaders', dynLibName);
  98.                     //Node.Copy('/Libraries/Context Library/Components', dynLibName);
  99.                     Library.CreateContextLib('/Libraries/Context Library/Shaders', dynLibName);
  100.                     Library.CreateContextLib('/Libraries/Context Library/Components', dynLibName);
  101.                 }
  102.                 if (bShowLW) 
  103.                 {
  104.                     //Node.Copy('/Libraries/Context Library/LW Shader Bricks', dynLibName);
  105.                     Library.CreateContextLib('/Libraries/Context Library/LW Shader Bricks', dynLibName);
  106.                 }
  107.             }
  108.             else
  109.             {
  110.                 // use old library
  111.                 dynLibName = oldLibName;
  112.             }
  113.  
  114.         }
  115.     }        
  116.  
  117.     
  118.     if(dynLibName == '')
  119.     {
  120.         // if there is no dynamic library to open
  121.         // close toolbar and existing library (if any)
  122.         if(oldLibName != '')
  123.         {
  124.             WindowsManager.CloseWindow(ret.Param('Dynamic Lib WinID'));
  125.             Node.Delete(oldLibName);
  126.  
  127.             // set output param
  128.             ret.Param('Dynamic Lib WinID') = '';
  129.             ret.Param('Lib Name') = '';
  130.         }
  131.     }
  132.     else
  133.     {
  134.         // check if already opened
  135.         if(oldLibName != '')
  136.         {
  137.             //WindowsManager.CloseWindow(ret.Param('Dynamic Lib WinID'));
  138.         }
  139.         else
  140.         {
  141.             // show the library, snap and set owner  
  142.             frameID = Library.ShowLibraryEx(dynLibName, false);
  143.             WindowsManager.SnapFrameToFrameEx(LEFrameName, frameID, 11, 11, 0, 0);
  144.             WindowsManager.SetFrameOwnerFrame(frameID, LEFrameName); 
  145.         
  146.  
  147.             // set output param
  148.             ret.Param('Dynamic Lib WinID') = frameID; 
  149.             ret.Param('Lib Name') = dynLibName; 
  150.         }
  151.     }
  152. }
  153.         ]]></SCRIPT_CODE>
  154. </SCRIPT>
  155.